package com.fruit.web.vo.shopcart;

import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.model.SelectItem;
import com.fruit.utils.DeliveryUtil;
import com.fruit.utils.MessageFactory;
import com.fruit.utils.PaymentTypeUtil;
import com.fruit.utils.PaymentUtil;
import com.fruit.utils.SpringFacesUtil;
import com.fruit.web.constant.EjdConstants;
import com.fruit.web.vo.common.OrderCrudBean;
import com.fruit.web.vo.genl.ExistPeriodReceiveTimeBean;

@ManagedBean(name="shopCart")
@SessionScoped
public class ShopCartBean extends OrderCrudBean implements java.io.Serializable {
	
	public ShopCartBean() {
		init();
		this.setCouponChecked(false);
		this.setCouponScore(0D);
		this.setIntegrationChecked(false);
		this.setIntegrationScore(0D);
		//set delivery
		this.setDeliveries(DeliveryUtil.getDeliveries());
		//set payment
		this.setPayments(PaymentUtil.getPayments());
		//set paymenttype
		this.setPaymentTypes(PaymentTypeUtil.getPaymentTypes());
		//set default address
		this.setActionSetAddress(EjdConstants.ACTION_VIEW_TYPE);
		//set default invoice
		this.setActionSetInvoice(EjdConstants.ACTION_VIEW_TYPE);
		SelectItem[] tempAddressItems = new SelectItem[1];
		String firstDefaultAddressN18 = MessageFactory.getMessage(EjdConstants.USER_BUNDLE_NAME,"select.one.address.message", FacesMessage.SEVERITY_ERROR).getDetail();
		tempAddressItems[0]= new SelectItem(EjdConstants.BLANK_VALUE_SELECT_ITEM,firstDefaultAddressN18);
		this.setAddressItems(tempAddressItems);
		this.setMaxBuyGoodsNumber(new Integer(EjdConstants.MAX_BUY_GOODS_NUMBER));
		ExistPeriodReceiveTimeBean existPeriodReceiveTime = (ExistPeriodReceiveTimeBean)SpringFacesUtil.getManagedBean("existPeriodReceiveTime");
	}
	
}
